package com.hfy.kandian.controller;


import com.hfy.kandian.entity.User;
import com.hfy.kandian.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author HAN XIAOYANG
 * @since 2020-12-30
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    public FollowService followService;

    @GetMapping("/doFollow/{thisId}/{targetId}")
    public int doFollow(@RequestParam int thisId, @RequestParam int targetId) {
        return followService.doFollow(thisId, targetId);
    }

    @GetMapping("/unfollow/{thisId}/{targetId}")
    public int unFollow(@RequestParam int thisId, @RequestParam int targetId){
        return followService.unFollow(thisId, targetId);
    }

    @GetMapping("/showFollower/{thisId}")
    public List<User> showFollower(@RequestParam int thisId){
        return followService.showFollower(thisId);
    }

    @GetMapping("/showTargets/{thisId}")
    public List<User> showTargets(@RequestParam int thisId){
        return followService.showTargets(thisId);
    }

}

